/**
 * Created by Francis.LW on 2017/10/20.
 *
 * 保险订单服务接口
 */
import {postRequest, getRequest} from '@/common/request'
import {urls} from './url'

const insuranceOrderApi = urls.insuranceOrder
const baseUrl = insuranceOrderApi.baseUrl
const action = insuranceOrderApi.action

function list(param, page, pageSize, success, complete) {
  postRequest(baseUrl + action.list + '?currentpage=' + page + '&pagesize=' + pageSize, {}, param, success, complete)
}


function handleOrderValid(param, success, complete) {
  postRequest(baseUrl + action.handleOrderValid, {}, param, success, complete)
}


function get(id, success, complete) {
  getRequest(baseUrl + action.get + id, {}, success, complete)
}

function remove(ids, success, complete) {
  postRequest(baseUrl + action.remove, {}, ids, success, complete)
}

/**
 *
 * @param ids
 * @param success
 * @param complete
 */
function deleteSingleInsuranceOrder(id, success, complete) {
  let ids = []
  ids.push(id)
  remove(ids, success, complete)
}

export default {
  list,
  handleOrderValid,
  get,
  remove,
  deleteSingleInsuranceOrder
}
